package com.ellecity06.cwhiskymall.adapter

import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.chad.library.adapter.base.BaseQuickAdapter
import com.ellecity06.common.ktx.load
import com.ellecity06.common.viewholder.ViewBindingHolder
import com.ellecity06.cwhiskymall.bean.response.AppMenuSettingRespone
import com.ellecity06.cwhiskymall.databinding.ItemNewerGoodBinding
import com.ellecity06.cwhiskymall.storage.UserStorage

/**
 * @author ellecity06
 * @time 2024/10/23 13:33
 * @des
 */
class NewerGoodAdapter : BaseQuickAdapter<AppMenuSettingRespone.SettingWebLayoutVOS.GoodsVO, ViewBindingHolder<ItemNewerGoodBinding>>() {
    override fun onBindViewHolder(
        holder: ViewBindingHolder<ItemNewerGoodBinding>, position: Int, item: AppMenuSettingRespone.SettingWebLayoutVOS.GoodsVO?
    ) {
        holder.binding.tvGoodName.text = item?.spuName?: ""
        holder.binding.ivGood.load(context, item?.spuImage,8F)
        holder.binding.tvPrice.text =item?.salesPrice.toString()
        holder.binding.ivTag.visibility =  UserStorage.upVisible()
    }

    override fun onCreateViewHolder(context: Context, parent: ViewGroup, viewType: Int): ViewBindingHolder<ItemNewerGoodBinding> {
        return ViewBindingHolder(ItemNewerGoodBinding.inflate(LayoutInflater.from(context), parent, false))
    }


}